﻿using System;
using System.Collections.Generic;
using System.Data;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSunny.Admin.Controls
{
    public partial class ViewDetailNews : System.Web.UI.UserControl
    {
        public int newsid;
        public string title;
        public string description;
        public string date;
        public string decodenoidung;
        public string image;
        public string summary;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["newsid"] != null)
            {
                newsid = Convert.ToInt32(Request.QueryString["newsid"]);
                DataTable dt = DAL.DCollector.DBCollector.Instance.StoredSelectTableWhereID("tbl_News","News_ID", newsid.ToString());
                //summary = dt.Rows[0]["News_Summary"].ToString();
                description = dt.Rows[0]["News_Description"].ToString();
                decodenoidung = Server.HtmlDecode(description);
                image = dt.Rows[0]["News_Image"].ToString();
                title = dt.Rows[0]["News_Name"].ToString();
                date = dt.Rows[0]["News_Date"].ToString();
                txtTitle.Text = title;
                CKEditorNoidung.Text = decodenoidung;
                txtSummary.Text = summary;

            }
        }

        protected void lbtDelete_Click(object sender, EventArgs e)
        {
            DAL.DCollector.DBCollector.Instance.StoredDelete("tbl_News", "News_ID", newsid.ToString());
            Response.Redirect("/Admin/Index.aspx?pane7&sub=10");
        }
    }
}